<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<%@ page import="java.util.Vector,
                                    com.epro.standard.frontend.util.FileInfoUtil,
                                    com.softplus.carrefour.hd.bltier.pc.*,
                                    com.softplus.carrefour.hd.CFHDSystem,
                                    com.softplus.carrefour.CFException,
                                    com.softplus.carrefour.hd.bltier.entity.UserAccount,
                                    com.epro.standard.frontend.datasetup.MessageManager,
                                    com.softplus.carrefour.hd.bltier.entity.CfhdCaseHead,
                                    com.softplus.carrefour.hd.bltier.admin.UserLevelManage" 
 %>
<%@ taglib uri="/WEB-INF/HeadTag.tld" prefix="head"%>
<%@ taglib uri="/WEB-INF/ErrorTag.tld" prefix="error"%>
<%@ include file="../include/eproFileInfo.jsp" %>
<%
        // View All Case User Level 1 View 
        ICaseHeadViewer     headViwer     = null;
        FileInfoUtil                   fileInfoUtil       = (FileInfoUtil) session.getAttribute("fileInfoUtil");

        UserAccount               userVO           =  (UserAccount) session.getAttribute("userVO"); //"kunlaporn_c";
                        
                    System.out.println(" === UID > "+userVO.getUserId());

        String           caseType         =  request.getParameter("caseType")!=null?request.getParameter("caseType"):"all";
        String          menuIDCode   = " CFHDPCMT02 ";
        String          PageName	      = " View All Cases : User Level 1 ";
        String          menuDesc	      = " View All Cases : User Level 1 ";
        
        String          opnPageURL   = "CFHDPCMT05.jsp"; //open Case Page
        String          viewPageURL  = "CFHDPCMT06.jsp"; //view Page
        String          modPageURL  = "/CFHD/servlet/com.softplus.carrefour.hd.frontend.servlet.process.CFHDPC07_0"; //"CFHDPCMT07.jsp"; //modify Page
        String          thisURL             = java.net.URLEncoder.encode((request.getRequestURI()+(request.getQueryString()!=null?"?"+request.getQueryString():"")));
        String          menuPgURL    = "/CFRL/CFRLWEBMN01.jsp";
        
        String          scrollHieght     =  "88px"; //for 3 category
        String          scrollFull          =  "310px";
        String          scrollNodata    =  "18px";
        
        fileInfoUtil.setMenuIDCode(menuIDCode);
        fileInfoUtil.setMenuName(menuDesc);
        fileInfoUtil.setMasterWording(menuDesc);
//        fileInfoUtil.setBackToMenu("/CFRL/CFRLWEBMN01.jsp");
        fileInfoUtil.setBackToMenu(thisURL);
        fileInfoUtil.setMenuDesc(PageName);
        fileInfoUtil.setDetailURL(viewPageURL); // view by case
        fileInfoUtil.setUpdateURL(modPageURL); // modify case
        fileInfoUtil.setInsertURL(opnPageURL); // open case

        session.setAttribute("fileInfoUtil",fileInfoUtil);

%>
<%               
          System.out.println(" * * * * * * * *  "+request.getRequestURL());
%>
<html>
  <head>
    <title>View All Cases : User Level 1 View.</title>
          <script src="../script/spToolbar.js" type="text/javascript"></script>
          <script src="../script/Alert.js" type="text/javascript"></script>
          <script src="../script/spTitleRefresh.js" type="text/javascript"></script>
          <link rel="stylesheet" href="../theme/viewCaseTheme.css" />
          <link rel="stylesheet" href="../theme/defaultTheme.css" />
          <%@ include file="../include/spPageRefresh.jsp" %>        
          <%@ include file="../include/spienocache.jsp" %>
          <%@ include file="../include/spAuthorization.jsp" %>
</head>
  <body>
  <%@ taglib uri="/WEB-INF/displaytag-12.tld" prefix="display"%>

<%=   fileInfoUtil.MasterHeadTable()  %>
  <table width="99%"  border="0" cellspacing="0" cellpadding="0" style="margin-left:3px;">
  <tr>
    <td align="center">
    <form action="<%= request.getRequestURI()+"?"+request.getQueryString() %>" id="form1" method="get">
<%
          java.util.Enumeration    e =  request.getParameterNames();
          while(e.hasMoreElements()){
          
               String    paramName =    (String) e.nextElement();
               String    paramValue  = request.getParameter(paramName);
//               System.out.print("paramName : >"+paramName+"< ");
//               System.out.println(" = >"+paramValue+"< ");
               if(!paramName.equalsIgnoreCase("casetype")){
                    out.println("<input type=\"HIDDEN\" name=\""+paramName+"\" value=\""+paramValue+"\" />");
               }
          }
    %>
	<fieldset class="titleFont" style=" width:65%; margin:5px 15px 2px 25px;"><legend>Case Category</legend>
		<table border="0" align="center" cellpadding="2" cellspacing="1">
		<tr>
    <td>&nbsp;</td>
    <td nowrap >
      <input name="caseType" type="radio" id="allCase" value="all" onclick="form1.submit();" <%= (caseType.equals("all")?" checked ":"") %> >
		  <label for="allCase">All</label></td>
		<td>
      <input name="caseType" id="takenCase" type="radio" value="taken" onclick="form1.submit();" <%= (caseType.equals("taken")?" checked ":"") %>>
		  <label for="takenCase">Taken Case</label></td>
		<td>
      <input name="caseType" id="myCase" type="radio" value="my" onclick="form1.submit();" <%= (caseType.equals("my")?" checked ":"") %>>
		  <label for="myCase">My Case</label></td>
		<td>
      <input name="caseType" id="returnedCase" type="radio" value="returned" onclick="form1.submit();" <%= (caseType.equals("returned")?" checked ":"") %>>
		  <label for="returnedCase">Returned Case</label></td>
		<td>&nbsp;</td></tr>
		</table>
	</fieldset>
  </form>
   </td>
  </tr>
  <tr>
    <td class="borderFontColor">
    <a href="<%= menuPgURL %>"><img src="../images/icon/toolbar/nBackToMenu.gif" width="21" height="21" onmouseout="imgOut(this)" onmouseover="imgOver(this)" alt="Back to Menu"></a>
    <a href="<%= opnPageURL %>"><img src="../images/icon/toolbar/nOpenCase.gif" height="21" width="21" onmouseout="imgOut(this)" onmouseover="imgOver(this)"  alt="Open Case"></a>
    <a href="CFHDPCMT08.jsp?linkfrom=<%= thisURL %>"><img src="../images/icon/toolbar/nSearch.gif" width="21" height="21" onmouseout="imgOut(this)" onmouseover="imgOver(this)" alt="Search"></a>&nbsp;<%= fileInfoUtil.MasterWording() %>
    </td>
   
  </tr>
  <tr>
    <td align="center">
    <%
       
        try{
                        headViwer           = (CCaseHeadManage)CFHDSystem.getControlClass("CASE_HEAD");
             
               if(caseType.equals("taken")||caseType.equals("all")) {
                       Vector   dataVec = headViwer.getTakenCaseHeadByUserID(userVO.getUserId());
                       String    divHeight = scrollHieght;
                       
                        if (caseType.equals("taken"))    divHeight = scrollFull;
                        if (dataVec.size()==0)                  divHeight = scrollNodata;
                         session.setAttribute( "taken", null );
                         session.setAttribute( "taken", dataVec );
    %>
    <span class="viewCaseHeader"> Taken Case </span>
    <div style="height:<%= divHeight %>" class="tableContainer" id="tableContainer1">	
    <display:table name="sessionScope.taken" id="taken" defaultsort="4" styleClass="scrollTable" cellspacing="0" cellpadding="0" decorator="com.softplus.carrefour.hd.frontend.displaytag.process.viewallcases.viewCaseTableWrapper">
      <display:column headerStyleClass="fixedHeader" title="Case No." sortable="true" nowrap="true" align="left" property="takencaselink" maxLength="20"  style="width:125pt;" />
      <display:column headerStyleClass=" fixedHeader" title="Subject" property="subject" align="left" maxLength="43" />
       <display:column headerStyleClass=" fixedHeader" title="Owner" property="caseowner" align="left" maxLength="10" style="padding-left:5px;width:70pt;" />
       <display:column headerStyleClass=" fixedHeader" title="Severity" align="left" sortable="true" style="padding-left:5px;width:50pt;" decorator="com.softplus.carrefour.hd.frontend.displaytag.process.viewallcases.serverityDecorator" property="severity" />
       <display:column headerStyleClass=" fixedHeader" title="Status" property="caseStatus" align="left"  style="padding-left:5px;width:50pt;" decorator="com.softplus.carrefour.hd.frontend.displaytag.process.viewallcases.caseStatusDecorator" />
    </display:table>
    </div>
    <% 
        }
        
         if(caseType.equals("my")||caseType.equals("all")) {
               Vector   dataVec = headViwer.getCaseHeadByUserID(userVO.getUserId());
               String    divHeight = scrollHieght;
               
                if (caseType.equals("my")) divHeight = scrollFull;
                if (dataVec.size()==0)               divHeight = scrollNodata;
                 session.setAttribute( "my", null );
                 session.setAttribute( "my", dataVec );
    %>
    <span class="viewCaseHeader"> My Case </span>
    <div style="height:<%= divHeight %>" class="tableContainer" id="tableContainer2">	
    <display:table name="sessionScope.my" id="my" defaultsort="4"  styleClass="scrollTable" cellspacing="0" cellpadding="0" decorator="com.softplus.carrefour.hd.frontend.displaytag.process.viewallcases.viewCaseTableWrapper">
      <display:column autolink="true"  headerStyleClass=" fixedHeader" title="Case No." sortable="true" nowrap="true" align="left" property="mycaselink" maxLength="20"  style="width:125pt;" />
      <display:column headerStyleClass=" fixedHeader" title=" Subject " property="subject" align="left" maxLength="43" />
       <display:column headerStyleClass=" fixedHeader" title="Owner" property="caseowner" align="left" maxLength="10" style="padding-left:5px;width:70pt;" />
       <display:column headerStyleClass=" fixedHeader" title="Severity" align="left" sortable="true" style="padding-left:5px;width:50pt;" decorator="com.softplus.carrefour.hd.frontend.displaytag.process.viewallcases.serverityDecorator" property="severity" />
       <display:column headerStyleClass=" fixedHeader" title="Status" property="caseStatus" align="left"  style="padding-left:5px;width:50pt;" decorator="com.softplus.carrefour.hd.frontend.displaytag.process.viewallcases.caseStatusDecorator" />
    </display:table>
    </div>
    <%
         }
         
         if(caseType.equals("returned")||caseType.equals("all")) {
               Vector   dataVec = headViwer.getReTurnCaseHeadByUserID(userVO.getUserId());
               String    divHeight = scrollHieght;
               
                if(caseType.equals("returned")) divHeight = scrollFull;
                if (dataVec.size()==0)              divHeight = scrollNodata;
                 session.setAttribute( "returned", null );
                 session.setAttribute( "returned", dataVec );
    %>
    <span class="viewCaseHeader"> Returned Case </span>
    <div style="height:<%= divHeight %>"  class="tableContainer" id="tableContainer3">
    <display:table name="sessionScope.returned" id="returned" defaultsort="4"  styleClass="scrollTable" cellspacing="0" cellpadding="0" decorator="com.softplus.carrefour.hd.frontend.displaytag.process.viewallcases.viewCaseTableWrapper">
      <display:column headerStyleClass=" fixedHeader" title="Case No." sortable="true" nowrap="true" align="left" property="returnedcaselink" style="width:125pt;" maxLength="20" />
      <display:column headerStyleClass=" fixedHeader" title="Subject" property="subject" align="left" maxLength="43"/>
       <display:column headerStyleClass=" fixedHeader" title="Owner" align="left" style="padding-left:5px;width:70pt;">&nbsp;</display:column>
       <display:column headerStyleClass=" fixedHeader" title="Severity" align="left" sortable="true" style="padding-left:5px;width:50pt;" decorator="com.softplus.carrefour.hd.frontend.displaytag.process.viewallcases.serverityDecorator" property="severity" />
       <display:column headerStyleClass=" fixedHeader" title="Status" property="caseStatus" align="left"  style="padding-left:5px;width:50pt;" decorator="com.softplus.carrefour.hd.frontend.displaytag.process.viewallcases.caseStatusDecorator" />
    </display:table>
    </div>
    <%
                }
        }catch(CFException cfe){
                System.out. println( cfe.getMessage());
                System.out. println( cfe.getDescription());
                session.setAttribute("hasError",cfe.getMessage());
               //session.setAttribute("hasError",cfe);
//                cfe.printStackTrace();
        }
    %>
</td>
  </tr>
</table>
<script type="text/javascript" src="../script/criticalHilight.js"></script>
</body>
</html>
<%@ include file="../include/eproErrorAlert.jsp"%>
